package com.zty.user.designPattern.templatePattern.prod;

import com.zty.bean.Result;

/**
 * @Author ZTY
 * @Description //模板和模板行为实际应用
 * @Date 2:05 2023-12-15
 **/

public class ApiTemplateDemo {

    public static void main(String[] args) {
        ApiTemplate apiTemplate = new ApiTemplate();
        Result result = Result.ok();

        //  Action里面写实际的业务逻辑代码
        apiTemplate.execute(result, new Action() {
            @Override
            public void validate() {
                System.out.println("开始校验");
            }

            @Override
            public void execute() {
                System.out.println("执行");
            }

            @Override
            public void after() {
                System.out.println("后续执行");
            }
        });
        System.out.println(result);
    }

}
